- if params[:part_id]
  = simple_form_for(@part_purchase_detail, html: {class: 'form-vertical', novalidate: true}, wrapper: :vertical_form) do |o|
    .row
      .col-md-12.hidden
        = o.input :part_purchase_id, input_html: { value: params[:id] }
        = o.input :part_id, input_html: { value: params[:part_id] }
      .col-md-12
   
        = o.input :aa, label: '配件分类', input_html: { value: @part.part_style.name }, disabled: true

        = o.input :aa, label: '配件编号', input_html: { value: @part.code }, disabled: true

        = o.input :aa, label: '配件名称', input_html: { value: @part.name }, disabled: true
          
        = o.input :aa, label: '单位', input_html: { value: @part.unit }, disabled: true

        = o.input :aa, label: '采购单价', input_html: { value: @part.purchase_price }, disabled: true
          
        = o.input :qty, label: '数量', input_html: { value: 1 }

        = o.button :submit, "保存", :class => 'btn-success btn-xs'
-else
   form method='get'
     a href='/part_styles' 新增
     .row
       .col-md-6
         .form-group
            label 配件分类
            select.form-control name="part_style_id"
              - @part_styles.each do |p|
                option value="#{p.id}" = "#{p.name}"
         .form-group
            label 配件编号
            input type="text" class="form-control" name="code" required="required"
         .form-group
            label 配件名称
            input type="text" class="form-control" name="name"
         .form-group
            label 单位
            input type="text" class="form-control" name="unit"
       .col-md-6
         .form-group
            label 采购价
            input type="text" class="form-control" name="purchase_price" required="required"
         .form-group
            label 销售价
            input type="text" class="form-control" name="sales_price" required="required"
         .form-group
            label 数量
            input type="text" class="form-control" name="qty" required="required"


     input type='submit' class='btn btn-success btn-xs' name='new_part' value='保存'
     